{include file="public/header" /}
<body>
<div class="x-body">
    <form class="layui-form">
        {volist name="$measuringInfo" id="measuringInfoList"}
        <div class="layui-form-item">
            <label class="layui-form-label">编号</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="measuring_id" value="{$measuringInfoList.measuring_id}" title="禁止修改" disabled>
                <input type="hidden" class="layui-input" name="id" value="{$measuringInfoList.id}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline">
                <div class="layui-input-inline">
                    <select name="measuring_name" lay-verify="required" lay-search="">
                        <option value="{$measuringInfoList.measuring_name}">{$measuringInfoList.measuring_name|getMeasuringName}</option>
                        <optgroup label="选择名称">
                            {volist name="$measuringType" id = "measuringTypeList"}
                            <option value="{$measuringTypeList.id}">{$measuringTypeList.cost_name}</option>
                            {/volist}
                        </optgroup>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">模型</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="model" value="{$measuringInfoList.model}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">生产场所</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="place_production" value="{$measuringInfoList.place_production}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">生产编号</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="production_num" value="{$measuringInfoList.production_num}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">检查周期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="inspection_cycle" value="{$measuringInfoList.inspection_cycle}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保管人</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="keeper" value="{$measuringInfoList.keeper}">
            </div>
        </div>
        {/volist}
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button class="layui-btn" lay-submit lay-filter="addId" >
                确认修改
            </button>
        </div>
    </form>
</div>
</body>
<script>
    layui.use(['form'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        //监听提交
        form.on('submit(addId)', function(data){
            //console.log(data);
            $.post("{:url('index/Measuring/update')}",data.field,function(info){
                if (info) {
                    layer.alert("修改成功", {icon: 6},function () {
                        window.parent.location.reload();  //刷新父级页面
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前弹出层
                        parent.layer.close(index);
                    });
                }else{
                    layer.alert("修改失败", {icon: 5});
                }
            },'json');
            return false;
        });
    });
</script>

</html>